import request from '@/config/axios'

export interface CraftProductProcessVO {
  id: number
  dictProcessName: number
  dictIsProduction: number
  dictReportWay: number
  dictProcessStatus: number
  remark: string
  parentId: number
  sort: number
  createTime: Date
}

// 查询配置中心--工艺配置--产品工序列表
export const getCraftProductProcessPage = async (params) => {
  return await request.get({ url: `/config/craft-product-process/page`, params })
}

// 查询配置中心--工艺配置--产品工序详情
export const getCraftProductProcess = async (id: number) => {
  return await request.get({ url: `/config/craft-product-process/get?id=` + id })
}

// 新增配置中心--工艺配置--产品工序
export const createCraftProductProcess = async (data: CraftProductProcessVO) => {
  return await request.post({ url: `/config/craft-product-process/create`, data })
}

// 修改配置中心--工艺配置--产品工序
export const updateCraftProductProcess = async (data: CraftProductProcessVO) => {
  return await request.put({ url: `/config/craft-product-process/update`, data })
}

// 删除配置中心--工艺配置--产品工序
export const deleteCraftProductProcess = async (id: number) => {
  return await request.delete({ url: `/config/craft-product-process/delete?id=` + id })
}

// 导出配置中心--工艺配置--产品工序 Excel
export const exportCraftProductProcess = async (data) => {
  return await request.download({ url: `/config/craft-product-process/export-excel`, data })
}

// 配置中心--工艺配置--产品工序-细部工序上移
export const moveUpCraftProductProcess = async (id: number, parentId: number) => {
  return await request.post({ url: `/config/craft-product-process/move-up?id=${id}&parentId=${parentId}` })
}

// 配置中心--工艺配置--产品工序-细部工序下移
export const moveDownCraftProductProcess = async (id: number, parentId: number) => {
  return await request.post({ url: `/config/craft-product-process/move-down?id=${id}&parentId=${parentId}`  })
}